<%@page import="com.bluedon.ism.commons.shiro.RBACConstants"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>  
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache">   
	<%@ include file="/commons/script.jsp" %>
	<link href="${ctx}/js/jquery-ui/css/jquery-ui.css" type="text/css" rel="stylesheet" />
	<script src="${ctx}/js/jquery-ui/js/jquery-ui-min.js" type="text/javascript"></script>
	<script type="text/javascript" src="${ctx}/js/My97DatePicker/WdatePicker.js" ></script>
	<style type="text/css">
        #delForm{line-height: 35px;text-align: center;font-weight: bolder;}
        #delForm .Wdate{width: 170px;font-size: 12px;}
	</style>
	<script type="text/javascript">
	$(document).ready(function(){
        setTimeout(function(){
            $("#feedDiv").hide(1500);
        },3000);
		var varPagenumber='${pager.pageNo}';
		var varPageSize= '${pager.pageSize}';
	   	var varPagecount='${pager.totalPage}';
		$("#pager").pager({ pagenumber: varPagenumber, pagecount: varPagecount, pagesize:varPageSize,submitType:"form", formId:"list_form"});
	 });
	
	</script>
<title>安全系统—列表</title>
<body>
<s:form id="list_form" method="post" action="findOperatelogPage.do" namespace="/admin/operatelog">
<s:hidden value="no" name="export" id="export" />
  <div class="m_right">
    <div class="m_r_tips">
       <div class="m_r_lefttips">您现在的位置：<a href="${ctx}/admin/home.jsp">首页</a>&gt;系统管理&gt;日志记录</div>
	  	<jsp:include page="/commons/admin/admin_login_remind.jsp"/>
	</div>
	<div class="line"></div>
	<div class="m_r_list">
	   <div class="m_r_list_pic"></div>
		   <div class="m_l_list_search">
	   			关键词：
	         <s:textfield name="keywords" id="keyword1" cssClass="text_input_1" style="width: 320px;" placeholder="用户名/操作模块/操作类型/操作内容" value="%{#attr.keywords}"/>
	         	开始日期:<input name="startTime" id="startTime" value="${startTime }" class="Wdate" type="text"
                            onFocus="WdatePicker({readOnly:true,maxDate:'#F{$dp.$D(\'endTime\')}'})"/>
	            结束日期:<input name="endTime" id="endTime" value="${endTime }" class="Wdate" type="text"
                            onFocus="WdatePicker({readOnly:true,minDate:'#F{$dp.$D(\'startTime\')}'})"/>
	        	<br/>
	            <a class="m_r_bnt1"><input type="submit" name="Submit" value="查询" /></a>
	   </div>
	</div>

      <s:if test="#session.DO_FEEDBACK != null" >
          <div class="m_r_tips" id="feedDiv">
              <div class="m_r_lefttips"><span style="color:red">
                  ${DO_FEEDBACK}
                  <% session.removeAttribute("DO_FEEDBACK"); %>
               </span></div>
          </div>
      </s:if>

<div class="m_r_table">
	<table width="100%" border="0" cellspacing="1" cellpadding="0">
        <shiro:hasRole name="<%=RBACConstants.PC.CITY_AUDITOR_ROLE%>">
        <tr>
            <td class="m_r_table_td" colspan="8" >
                <a href="#" id="go_del"><img src="${ctx}/images/list6.gif"/>删除</a>
                &nbsp;&nbsp;|&nbsp;&nbsp;
                <a href="#" id="go_delByTime"><img src="${ctx}/images/list6.gif"/>按时间段删除</a>
            </td>
        </tr>
        </shiro:hasRole>
        <tr>
            <td class="m_r_table_tr bold"><input type="checkbox" value="" id = "p_box"/></td>
            <td class="m_r_table_tr bold">序号</td>
            <td class="m_r_table_tr bold">操作者</td>
            <td class="m_r_table_tr bold">操作模块</td>
            <td class="m_r_table_tr bold">操作类型</td>
            <td class="m_r_table_tr bold">操作内容</td>
            <td class="m_r_table_tr bold">操作时间</td>
            <td class="m_r_table_tr bold">登录IP</td>
        </tr>
 	    <s:if test="pager.list.size == 0">
            <tr><td align="center" colspan="8">没有查询到相关数据信息!</td></tr>
	    </s:if>
 	    <s:else>
 		 <s:iterator var="operatelog" value="pager.list" status="stat">
 		 		<tr <s:if test="#stat.even">class="m_r_table_tr_bg"</s:if>>
                    <td><input type="checkbox" value="${operatelog.lid }" name = "s_box" /></td>
					<td nowrap="nowrap" height="24" class="m_r_table_trbai">
						<div align="center"><s:property value="#stat.index+1" /></div>
					</td>
                    <td nowrap="nowrap"  class="m_r_table_trbai">
					    <s:property value="account.realname"/>
					</td>
					<td nowrap="nowrap"  class="m_r_table_trbai"><s:property value="moduleName"/></td>
					<td nowrap="nowrap"  class="m_r_table_trbai"><s:property value="typeName"/></td>
					<td  class="m_r_table_trbai"><s:property value="message"/></td>
					<td nowrap="nowrap"  class="m_r_table_trbai"><s:date name ="createTime" format="yyyy-MM-dd HH:mm:ss"/></td>
                    <td nowrap="nowrap" class="m_r_table_trbai"><s:property value="ipAddress"/></td>
				</tr>
 		 </s:iterator>
 	</s:else>
	</table>
</div>
<div class="pageDiv">
       <span class="pageL">共有<font color="#0e83af">${pager.totalRecord}</font>条数据</span>
       <div id="pager"></div>
   </div>
</div>
</s:form>
<div id="delByTimeDiv" style="display: none;">
<input type="text" name="fns" value="" readonly="readonly" style="width: 1px; height: 1px; border: 0px;"/>
<s:form id="delForm" method="post" action="delLogs.do" namespace="/admin/operatelog">
    开始日期：<input name="startTime" id="startTime2" class="Wdate" type="text"
            onFocus="WdatePicker({readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'endTime2\')}'})"/>
    <br/>
    结束日期：<input name="endTime" id="endTime2" class="Wdate" type="text"
            onFocus="WdatePicker({readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'startTime2\')}'})"/>
    <br/>
    <a class="m_r_bnt1"><input type="submit" name="Submit2" value="确&nbsp;&nbsp;定" /></a>
</s:form>
</div>
</body>
<script src="${ctx}/js/checkbox-table.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
    <shiro:hasRole name="<%=RBACConstants.PC.CITY_AUDITOR_ROLE%>">
    $("#go_del").click(function(){
        var c = getCheckCountByName('s_box');
        if (c == 0){
            alert("请选择要删除的日志");
            return;
        }
        var fns = encodeURIComponent(getCheckValues());
        if (window.confirm('确定删除吗')) {
            window.location.href = "${ctx}/admin/operatelog/delLogs.do?fns=" + fns;
        }
    });
    $("#go_delByTime").click(function(){
        $("#delByTimeDiv").dialog({
            title:"按时间段删除日志",
            autoOpen: true,
            modal: true,
            width:300,
            height:200,
            close: function(event, ui) {                   //关闭时触发事件
                $( "#delForm").get(0).reset();
            }
        });
    });
    $("#delForm").submit(function(){
        var startTime = $.trim($("#startTime2").val());
        var endTime = $.trim($("#endTime2").val());
        var bakMsg = "";
        if((!startTime&&!endTime)||(startTime==""&& endTime=="")){
            alert("请选择日期后再继续！");
            return false;
        }
        if(startTime&&$.trim(startTime)!=""){
            bakMsg = "删除 "+startTime;
            if(!endTime||$.trim(endTime)=="")
                bakMsg+=" 之后的日志数据";
        }
        if(endTime&&$.trim(endTime)!=""){
            if(startTime&& $.trim(startTime)!="")
                bakMsg+=" 到 "+endTime+" 之间的日志数据";
            else
                bakMsg="删除 "+endTime+" 之前的日志数据";
        }
        if(!window.confirm("确认"+bakMsg))
            return false;
    });
    </shiro:hasRole>
});
</script>
</html>

